package com.guoyansoft.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author 刘耀诚
 * 该配置类实现拦截器注册
 */

//@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    @Autowired
    private MyInterceptor myInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
//        注入拦截器
        registry.addInterceptor(myInterceptor)
//                配置所有的请求都拦截
                .addPathPatterns("/**")
//                配置哪些请求不拦截
        .excludePathPatterns("/administrators/login");
    }
}
